package com.wy.leetCode;

/**
 * @author HelloWorld
 * @create 2021/9/24 15:31
 * @email 154803771@qq.com
 */
public class IsPalindrome {

    public static void main(String[] args) {
        IsPalindrome isPalindrome = new IsPalindrome();
        //System.out.println(Integer.MAX_VALUE >= 1234567899);
        System.out.println(isPalindrome.isPalindrome(1234567899));
    }
    
    


    /** 
     * @description: 
     * @author: HelloWorld
     * @date: 2021/10/27 20:50
     * @param: x
     * @return: boolean
     */ 
    boolean isPalindrome(int x) {
        if (x < 0){
            return false;
        }else {
            StringBuilder stringBuilder = new StringBuilder(x + "");
            // 【坑】 反转后超过int 范围时会报错
            return x == Long.valueOf(stringBuilder.reverse().toString());
        }

    }
}
